<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>新增员工</title>
    <th:block th:include="common.html :: source"></th:block>
    <script type="text/javascript">
        function exit() {
            window.location.href = "/employee/list";
        }

        function saveEmp() {
            var empName=$("#empName").val();
            var phone=$("#phone").val();
            var qqCode=$("#qqCode").val();
            var weixin=$("#weixin").val();
            var email=$("#email").val();
            var university=$("#university").val();
            var address=$("#address").val();
            var remark=$("#remark").val();

            var major=$("#major").val();
            var isok = true;
            if(empName==""){
                $.messager.alert("操作提示", "请输入员工姓名！","error");
                $("#empName").focus();
                return;
            }
            if(phone==""){
                $.messager.alert("操作提示", "请输入手机号码！","error");
                $("#phone").focus();
                return;
            }
            if(university.length>30){
                $.messager.alert("操作提示", "毕业学校长度过长！","error");
                $("#university").focus();
                return;
            }
            if(major.length>30){
                $.messager.alert("操作提示", "专业长度过长！","error");
                $("#major").focus();
                return;
            }
            if(address.length>100){
                $.messager.alert("操作提示", "家庭地址长度过长！","error");
                $("#address").focus();
                return;
            }
            document.forms[0].submit();
        }


    </script>
</head>
<body>
<center>
    <form name="form1" id="form1"  action="/employee/save" method="post">
        <table style="height: 370px;width: 700px;margin-top: 10px" border="0">
            <tr style="height: 40px">
                <td align="right">员工姓名:</td>
                <td align="left"><input id="empName" name="employeeName" placeholder="请输入员工姓名" value="张三" style="width:200px;"></td>
                <td align="right">部门名称:</td>
                <td align="left">
                    <select  id="depId" name="departmentId"  style="width:205px;" >
                        <option th:each="department:${departmentList}" th:text="${department.departmentName}" th:value="${department.departmentId}"></option>
                    </select>
                </td>
            </tr>
            <tr  style="height: 40px">
                <td align="right">手机号码:</td>
                <td align="left">
                    <input type="text" id="phone" name="phone" value="123123" placeholder="请输入手机号"  style="width:200px;">
                </td>
                <td align="right">性别:</td>
                <td align="left">
                    <select  id="sex" name="sex"    style="width:205px;">
                        <option value="男">男</option>
                        <option value="女">女</option>
                    </select>
                </td>
            </tr>

            <tr style="height: 40px">
                <td align="right">邮箱地址:</td>
                <td align="left">
                    <input type="text" id="email"  name="email" value="111@163.com"placeholder="请输入邮箱地址" style="width:200px;">
                </td>
                <td align="right">家庭地址:</td>
                <td align="left">
                    <input type="text"  name="address" id="address" value="软件公寓" placeholder="请输入家庭地址"  style="width:200px;">
                </td>
            </tr>

            <tr style="height: 40px">
                <td align="right">毕业学校:</td>
                <td align="left">
                    <input type="text" id="university"  name="university" value="北京理工大学"placeholder="请输入毕业学校" style="width:200px;">
                </td>
                <td align="right">专业:</td>
                <td align="left">
                    <input type="text" id="major"  name="major" value="软件工程"placeholder="请输入专业" style="width:200px;">
                </td>
            </tr>

            <tr style="height: 40px">
                <td align="right">学历:</td>
                <td align="left">
                    <select  id="education" name="education"   style="width:205px;">
                        <option value="高中以下">高中以下</option>
                        <option value="专科">专科</option>
                        <option value="本科">本科</option>
                        <option value="本科以上">本科以上</option>
                    </select>
                </td>
                <td align="right">登录密码:</td>
                <td align="left">
                    <input type="text" name="password" value="123456" disabled placeholder="默认密码为123456" style="width:200px;">
                </td>
            </tr>
            <tr style="height: 40px">
                <td align="right" colspan="2">
                    <a class="easyui-linkbutton" icon="icon-save"  plain="true" href="javascript:void(0);"
                       onclick="saveEmp();">保 存</a>
                    <a class="easyui-linkbutton" icon="icon-undo"  plain="true" href="javascript:void(0);"
                       onclick="exit();">返 回</a>
            </tr>
        </table>
    </form>
</center>
</body>
</html>